package com.inepex.inechart.shared.axes;

/**
 * Defines the direction of an {@link Axis}
 */
public enum AxisDirection {
	Horizontal_Ascending_To_Right(1, 1), Horizontal_Ascending_To_Left(1, -1), Vertical_Ascending_To_Top(
			-1, 1), Vertical_Ascending_To_Bottom(-1, -1);
	private final int ascending;
	private final int direction;

	private AxisDirection(int direction, int ascending) {
		this.ascending = ascending;
		this.direction = direction;
	}

	public int getAscending() {
		return ascending;
	}

	public int getDirection() {
		return direction;
	}

	/**
	 * Determines whether the given axes are perpendicular
	 * 
	 * @param axis1
	 * @param axis2
	 * @return
	 */
	public static boolean isPerpendicular(Axis axis1, Axis axis2) {
		if (axis1.axisDirection.direction + axis2.axisDirection.direction == 0)
			return true;
		return false;
	}
}